package myapp.com.xm.myapplication.Adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import myapp.com.xm.myapplication.R;

public class Adapter2 extends RecyclerView.Adapter<Adapter2.ViewHoder> {
    private Context context;

    public Adapter2(Context context) {
        this.context = context;
    }

    @NonNull
    @Override
    public ViewHoder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.list_item_1, parent, false);
        return new ViewHoder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHoder holder, int position) {
        holder.tv_item.setText("222222");
    }

    @Override
    public int getItemCount() {
        return 20;
    }

    class ViewHoder extends RecyclerView.ViewHolder {
        private TextView tv_item;

        public ViewHoder(@NonNull View itemView) {
            super(itemView);
            tv_item = itemView.findViewById(R.id.tv_item);
        }
    }
}
